package com.sjlh.centurylianhua.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sjlh.centurylianhua.entity.ModuleRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ModuleRoleMapper extends BaseMapper<ModuleRole> {
    @Insert("<script> " +
            "insert into module_role(moduleId,roleId) values\n"+
            "<foreach collection= 'list' item= 'item'  separator=','>\n" +
            "(#{item.moduleId},#{item.roleId})\n"+
            "</foreach> \n"+
            "</script>")
    boolean modulerolelist(@Param(value = "list") List<ModuleRole> list);

    @Delete("<script>"+
            "delete from module_role where\n"+
            "<foreach collection='list' item='item' separator='or'>" +
            "(roleId=#{item.roleId} and moduleId=#{item.moduleId})</foreach>"+
            "</script>")
    boolean deletelist(@Param(value = "list") List<ModuleRole> list);
}
